//=======================================================
//AUTHOR: JEFF XL. ZHANG ARIZONA STATE UNIVERSITY
//ALL RIGHTS RESERVED  2008
//=======================================================
#pragma once
#include<stdlib.h>
#include<iostream>
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
#include "line.h"
#include "detection.h"
#include "display.h"
#include "line_feature.h"
#include "image_feature.h"
#include "data_structure.h"
#include "feature_comparison.h"
#include "line_database.h"

using namespace std;


Histogram construct_test_histogram(char* shape){
	Histogram artificial_hist;
	cout<<"TESTING HISTOGRAM VISUALIZATION ==========================================="<<endl;
	int i = 0;
	int number_of_bins = 256;
	vector<int> shape_int;
	while(shape[i]){
		char digit_buffer = shape[i];
		shape_int.push_back(atoi(&digit_buffer));
		i++;
	}
	for(int i = 0; i < 3; i++){
		for(int k = 0; k < shape_int.size(); k++){
			for(int j = 0; j < number_of_bins/shape_int.size(); j++){			//EACH LITTLE SEGMENT
//				if(j < 255/shape_int.size())
				artificial_hist.value_rgb[2][i][j + number_of_bins*k/shape_int.size()] = shape_int[k]*255;			//ONLY CONSIDERING CHANNEL 2
			}
		}
	}
	
	cout<<endl;
	return artificial_hist;
}


int test_hist_comparison(void){
	ImageFeature test_frame_anchor,test_frame_target;
	test_frame_anchor.Hists.push_back(construct_test_histogram("1612"));
	test_frame_target.Hists.push_back(construct_test_histogram("415"));
	test_frame_anchor.Hists[0].visualize(1,1,0);
	test_frame_target.Hists[0].visualize(1,1,0);


	FeatureComparison acomparison;
	acomparison.compare(test_frame_anchor,test_frame_target);		//INPUT TWO FRAMES 

	return 0;
}



void test_hist_visualization(void){
	//TESTING-HISTOGRAM VISUALIZATION============================================================================
	Histogram hist_01,hist_10,hist_101,hist_010, hist_test;
//	hist_01 = construct_test_histogram("01");	hist_01.visualize(1,1,0);
//	hist_10 = construct_test_histogram("10");	hist_10.visualize(1,1,0);
//	hist_010 = construct_test_histogram("010");	hist_010.visualize(1,1,0);
//	hist_101 = construct_test_histogram("101");	hist_101.visualize(1,1,0);
	hist_test = construct_test_histogram("03689998641");	hist_test.visualize(2,2,0);
	//TEST ENDED HERE==========================================================================================

}

